package com.spdzen.model;


import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.activerecord.Model;
import java.util.Date;

import javax.validation.constraints.Min;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.spdzen.support.validation.AddValidGroup;
import com.spdzen.support.validation.UpdateValidGroup;
import com.baomidou.mybatisplus.annotations.TableId;
import java.io.Serializable;


/**
 * <p>
 * 系统用户
 * </p>
 *
 * @author accountwcx@qq.com
 * @since 2017-03-16
 */
@TableName("spd_sys_user")
public class SysUser extends Model<SysUser> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */

	@TableId("id")
	@Min(value = 1L, groups = {UpdateValidGroup.class})
	private Long id;
    /**
     * 用户登录系统的名称
     */

	@TableField("login_name")
	@NotBlank
	@Length(max = 30, groups = {UpdateValidGroup.class, AddValidGroup.class})
	private String loginName;
    /**
     * 密码
     */

	@TableField("password")
	@NotBlank
	@Length(min = 6, max = 30, groups = {AddValidGroup.class})
	@JSONField(serialize=false)
	private String password;
    /**
     * 手机号
     */

	@TableField("phone")
	private String phone;
    /**
     * 邮箱
     */

	@TableField("email")
	private String email;
    /**
     * 用户头像
     */

	@TableField("headimgurl")
	private String headimgurl;
    /**
     * 真实姓名
     */

	@TableField("truename")
	@NotBlank
	@Length(max = 30, groups = {UpdateValidGroup.class, AddValidGroup.class})
	private String truename;
    /**
     * 性别，0表示保密，1表示男性，2表示女性
     */

	@TableField("gender")
	private Integer gender;
    /**
     * 状态，1表示正常，0表示已禁用
     */

	@TableField("status")
	private Integer status;
    /**
     * 用户类型，1表示普通用户，2表示超级用户，3表示隐藏用户（隐藏用户权限和超级用户一样，只是后台看不见）
     */

	@TableField("type")
	private Integer type;
    /**
     * 外键spd_sys_dept.id
     */

	@TableField("sys_dept_id")
	@Min(value = 1L)
	private Long sysDeptId;
    /**
     * 最后一次登录时间
     */

	@TableField("last_login_time")
	private Date lastLoginTime;
    /**
     * 最后一次登录ip
     */

	@TableField("last_login_ip")
	private String lastLoginIp;
    /**
     * 微信openid
     */

	@TableField("openid")
	private String openid;
    /**
     * 登录次数
     */

	@TableField("login_count")
	private Long loginCount;
    /**
     * 创建时间
     */

	@TableField("operate_time")
	private Date operateTime;
    /**
     * 更新时间
     */

	@TableField("operate_id")
	private Long operateId;


	public Long getId() {
		return id;
	}

	public SysUser setId(Long id) {
		this.id = id;
		return this;
	}

	public String getLoginName() {
		return loginName;
	}

	public SysUser setLoginName(String loginName) {
		this.loginName = loginName;
		return this;
	}

	@JSONField(serialize=false)
	public String getPassword() {
		return password;
	}

	public SysUser setPassword(String password) {
		this.password = password;
		return this;
	}

	public String getPhone() {
		return phone;
	}

	public SysUser setPhone(String phone) {
		this.phone = phone;
		return this;
	}

	public String getEmail() {
		return email;
	}

	public SysUser setEmail(String email) {
		this.email = email;
		return this;
	}

	public String getHeadimgurl() {
		return headimgurl;
	}

	public SysUser setHeadimgurl(String headimgurl) {
		this.headimgurl = headimgurl;
		return this;
	}

	public String getTruename() {
		return truename;
	}

	public SysUser setTruename(String truename) {
		this.truename = truename;
		return this;
	}

	public Integer getGender() {
		return gender;
	}

	public SysUser setGender(Integer gender) {
		this.gender = gender;
		return this;
	}

	public Integer getStatus() {
		return status;
	}

	public SysUser setStatus(Integer status) {
		this.status = status;
		return this;
	}

	public Integer getType() {
		return type;
	}

	public SysUser setType(Integer type) {
		this.type = type;
		return this;
	}

	public Long getSysDeptId() {
		return sysDeptId;
	}

	public SysUser setSysDeptId(Long sysDeptId) {
		this.sysDeptId = sysDeptId;
		return this;
	}

	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public SysUser setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
		return this;
	}

	public String getLastLoginIp() {
		return lastLoginIp;
	}

	public SysUser setLastLoginIp(String lastLoginIp) {
		this.lastLoginIp = lastLoginIp;
		return this;
	}

	public String getOpenid() {
		return openid;
	}

	public SysUser setOpenid(String openid) {
		this.openid = openid;
		return this;
	}

	public Long getLoginCount() {
		return loginCount;
	}

	public SysUser setLoginCount(Long loginCount) {
		this.loginCount = loginCount;
		return this;
	}

	public Date getOperateTime() {
		return operateTime;
	}

	public void setOperateTime(Date operateTime) {
		this.operateTime = operateTime;
	}

	public Long getOperateId() {
		return operateId;
	}

	public void setOperateId(Long operateId) {
		this.operateId = operateId;
	}

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

}